<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="com.lovefreedom.psi.bean.*"%>
<%@ page import="java.util.List" %>
<%@ page import="com.lovefreedom.psi.dao.*" %>
<%@ page import="com.lovefreedom.psi.dao.impl.*" %>
<%@ page import="com.lovefreedom.psi.util.*" %>

<%
	CategoryDao dao = new CategoryDaoImpl();	
	List list = dao.getCategoryTree();
	System.out.println(list.size());
	
	String categoryIds[] = request.getParameterValues("categoryIds");  	
	int categoryId = Integer.parseInt(categoryIds[0]);
	Category oldCategory = dao.findCategoryById(categoryId);
	
	Category parent = dao.findCategoryById(oldCategory.getParentId());
		
%>
<html>
<head>
<title>编辑货品目录信息</title>
<link href="../../scripts/ui/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="../images/style.css" rel="stylesheet" type="text/css" />
<link href="../../Images/css.css" rel="Stylesheet" type="text/css" />
<script type="text/javascript" src="../../scripts/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../../scripts/jQurey.FormValidator.js"></script> 

<script type="text/javascript">
$(document).ready(function() {
$("#categoryform").SetValidateSettings({});
$("#name").SetValidateSettings({
	FormValidate: {
		MaxLength: {
			Value: 10,
			Message: "货品目录名最长为10个字符"
		},
		MinLength: {
			Value: 6,
			Message: "货品目录名至少需要1个字符"
		}
	},
	Message: {
		Text: {
			Show: "请输入货品目录名！",
			Success: "输入正确！",
			Error: "必须输入货品目录名！",
			Focus: "正在输入..."
		},
		MessageSpaceHolderID: "TipName"
	}
});
});
</script>

</head>
<body class="mainbody">
<form action="update.action" method="post" name="categoryform" id="categoryform">
<div class="navigation"><a href="javascript:history.go(-1);" class="back">后退</a>首页 &gt; 货品分类管理 &gt; 修改货品分类</div>
<div id="contentTab">

    <div class="tab_con" style="display:block;">
        <table class="form_table">
            <col width="150px"><col>
            <tbody>
            <tr>
                <th>上级分类：</th>
                <td>                
                <select name="parentId" >             
                	<option value="<%=parent.getId()%>"><span style=width:<%=parent.getLevel()*18%>px;text-align:right;display:inline-block;></span><%=parent.getName()%></option>            	
                </select>
                </td>
            </tr>      
            
            <input type="hidden" name="id" id="id" value="<%=oldCategory.getId()%>" />        
            <tr>
                <th>分类名称：</th>
                <td><input type="text" name="name" id="name" value="<%=oldCategory.getName()%>" CssClass="txtInput" /></td>
                <td><tt id="TipName"></tt></td>                
            </tr>


            </tbody>
        </table>
    </div>

    <div class="foot_btn_box">
    <input name="保存" type="submit" class="btnSubmit" value="保 存" />
    <input name="重置" type="reset" class="btnSubmit" value="重 置" />
    </div>
</div>
</form>
</body>
</html>
